# golangci-lint
FROM golangci/golangci-lint:v1.43 as golangci

# jenkins image
FROM jenkins/jenkins:lts
# use root to update and install tools
USER root
# set debian source
COPY sources.list /etc/apt/

RUN apt-get update -q \
    && DEBIAN_FRONTEND=noninteractive apt-get install -qy aptitude \
    && aptitude install -y apt-transport-https ca-certificates vim wget python3 python3-pip

RUN curl -fsSL https://deb.nodesource.com/setup_16.x | bash - \
    && apt-get install -y nodejs

RUN npm install -g api-console-cli && npm install -g bower

# set go and golangci-lint env
COPY --from=golangci /usr/local/go /usr/local/go
COPY --from=golangci /usr/bin/golangci-lint /usr/local/go/bin

RUN export PATH=$PATH:/usr/local/go/bin \
    && go env -w GO111MODULE="on" \
    && go env -w GOPROXY="https://goproxy.cn,direct"